﻿Imports IRSO6.Usuarios
Imports System.Data.SqlClient
Public Class Login

    Inherits System.Web.UI.Page
    Public Property readerL As New List(Of Usuarios)

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ValidarSesion()

    End Sub

    Public Sub Unnamed1_Click(sender As Object, e As EventArgs)
        Dim log As Usuarios = New Usuarios
        log.Nombre = txtUsuario.Text
        log.Password = txtPassword.Text
        If (log.Validar(txtUsuario.Text, txtPassword.Text) = True) Then
            Session.Add("usuario", log.Nombre)
            Response.Redirect("/Menu.aspx?usuario=" + log.Nombre)
        Else
            Response.Write("Login Incorrecto")
        End If
    End Sub

    Sub ValidarSesion()
        If Session("usuario") = "" Then
            Else
            Dim usuario = Session("usuario").ToString()
            Response.Redirect("/Menu.aspx?usuario=" + usuario)
        End If
    End Sub


    
End Class